<template>
  <div>
    <div class="banner" @click="handleClickBanner">
      <img class="banner-img" :src="bannerImg" alt="">
      <div class="banner-info">
        <div class="banner-title">{{this.sightName}}</div>
      <div class="banner-number">
        <span class="iconfont ">&#xe612;</span>{{this.gallaryImgs.length}}
      </div>
      </div>
    </div>
    <common-gallery :imgs="gallaryImgs" v-show="showGallery" @close="handleGalleryClose"></common-gallery>
    <fade-animation>
    <common-gallery :imgs="imgs" v-show="showGallery" @close="handleGalleryClose"></common-gallery>
    </fade-animation>
  </div>
</template>

<script>
import CommonGallery from 'common/gallery/Gallery'
import fadeAnimation from 'common/fade/fadeAnimation'
export default {
  name: 'DetailBanner',
  props: {
    sightName: String,
    gallaryImgs: Array,
    bannerImg: String
  },
  data () {
    return {
      showGallery: false
    }
  },
  methods: {
    handleClickBanner () {
      this.showGallery = true
    },
    handleGalleryClose () {
      this.showGallery = false
    }
  },
  components: {
    CommonGallery,
    fadeAnimation
  }
}
</script>

<style lang="stylus" scoped>
.banner
  position relative
  overflow hidden
  height 0
  padding-bottom 55%
  .banner-img
    width 100%
  .banner-info
    display flex
    position absolute
    left:0
    right 0
    bottom: 0
    line-height .6rem
    background-image: linear-gradient(to bottom,rgba(0,0,0,0),rgba(0,0,0,.5));
    .banner-title
      font-size: .38rem;
      text-shadow: 0 1px 2px rgba(0,0,0,0.70);
      z-index: 1
      padding: .1rem 0 .2rem .2rem;
      flex 1
      color: #fff;
    .banner-number
      text-align center
      position absolute
      font-weight bold
      left 0
      top -.4rem
      width: 1.2rem;
      height: .4rem;
      line-height .4rem
      border-radius .2rem
      font-size: .24rem;
      color: #fff;
      background: rgba(0,0,0,.5);
</style>
